package com.whzm.web;

import com.whzm.pojo.MemberType;
import com.whzm.service.MemberBack;
import com.whzm.util.ResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/*
* 会员充值，支付回调，轮询
* */
@RequestMapping("/member-back")
@RestController
public class MemberInfoControllerBack {
    @Autowired
    MemberBack memberBack;
    MemberType newMemberType=new MemberType();

    /**查看会员信息*/
    @RequestMapping("getMemberInfo")
    public ResponseEntity getMemberInfo(Integer page,Integer limit){
        return memberBack.getMember(page,limit);
    }

    /**查看会员类型信息*/
    @RequestMapping("getMemberType")
    public ResponseEntity getMemberType(Integer page,Integer limit){
        return memberBack.getMemberType(page,limit);
    }

    /**修改会员类型信息,id+修改的属性*/
   @PostMapping("getMemberType-update")
    public ResponseEntity updateMemberType(@RequestBody MemberType memberType){
        return memberBack.updateMemberType(memberType);
    }

    /**删除会员类型信息,id+is_deleted*/
    @RequestMapping("getMemberType-delete")
    public ResponseEntity deleteMemberTyp(String id,Integer isDeleted){
        newMemberType.setId(id);
        newMemberType.setIsDeleted(isDeleted);
        return memberBack.updateMemberType(newMemberType);
    }


}
